#ifndef _TYPES_H_
#define _TYPES_H_

#define HIGHERHALF(a)	((dword) a + 0xC0000000)
#define LOWERHALF(a)	((dword) a - 0xC0000000)

typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned int dword;
typedef unsigned long long qword;

typedef signed char sbyte;
typedef signed short int sword;
typedef signed int sdword;
typedef signed long long sqword;

struct CPUContext {
	/* Segment registers */
	dword gs;
	dword fs;
	dword es;
	dword ds;

	/* pusha */
	dword edi;
	dword esi;
	dword ebp;
	dword old_esp;
	dword ebx;
	dword edx;
	dword ecx;
	dword eax;

	dword int_no;
	dword err_code;

	/* This pushed by cpu */
	dword eip;
	dword cs;
	dword eflags;

	/* Only with DPL change */
	dword esp;
	dword ss;

	/* v86 mode only */
	dword v86_es;
	dword v86_ds;
	dword v86_fs;
	dword v86_gs;
} __attribute__ ((packed));

#include <stddef.h>

typedef long pid_t;
typedef short uid_t;
typedef short gid_t;

#endif
